package com.glodon.paas.databag.sso;

import com.glodon.paas.account.sdk.sso.web.AbstractCasSingleSignOutFilter;
import org.springframework.beans.factory.annotation.Value;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Don Li
 */
public class CasSignleSignOutFilterImpl extends AbstractCasSingleSignOutFilter {

    @Value("${security.logout.path}")
    private String logoutPath;

    @Value("${security.logout.return_to}")
    private String returnTo;

    @Value("${security.logout.service.url}")
    private String serviceLogoutUrl;

    @Override
    protected boolean isSupported(HttpServletRequest request) {
        return logoutPath.equals(request.getServletPath());
    }

    @Override
    protected String getServiceId() {
        return "databag";
    }

    @Override
    protected String getReturnTo() {
        return returnTo;
    }

    @Override
    protected String getServiceLogoutUrl() {
        return serviceLogoutUrl;
    }
}
